Skip to content

Conversation

@Maosaic
Copy link
Collaborator

@Maosaic Maosaic commented Nov 13, 2025

Description

When user click on saved search on Assets page, it will navigate the user to Discover page and load the saved search. However, if user had visited Discover before in same session, Discover will automatcally append the filter state from the previous visit.

This PR allow skip loading previous filter, when user visit Discover page with URL contains saved search without params.

Issues Resolved

fixes #10811

Screenshot

Before:

Screen.Recording.2025-11-12.at.12.18.05.PM.mp4

After:

Screen.Recording.2025-11-12.at.6.21.57.PM.mp4

Testing the changes

Changelog

  • fix: Skip loading filter if navigating to a saved search without params

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@Maosaic Maosaic added the OSD Changes being merged by the OSD team label Nov 13, 2025
@github-actions
Copy link
Contributor

❌ Empty Changelog Section

The Changelog section in your PR description is empty. Please add a valid changelog entry or entries. If you did add a changelog entry, check to make sure that it was not accidentally included inside the comment block in the Changelog section.

@codecov
Copy link

codecov bot commented Nov 13, 2025

Codecov Report

❌ Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.75%. Comparing base (a1d2e7b) to head (a666255).

Files with missing lines Patch % Lines
...lic/application/view_components/canvas/top_nav.tsx 0.00% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10913   +/-   ##
=======================================
  Coverage   60.75%   60.75%           
=======================================
  Files        4533     4533           
  Lines      122209   122216    +7     
  Branches    20483    20486    +3     
=======================================
+ Hits        74250    74255    +5     
- Misses      42719    42723    +4     
+ Partials     5240     5238    -2     
Flag Coverage Δ
Linux_1 26.56% <0.00%> (-0.01%) ⬇️
Linux_2 38.92% <ø> (ø)
Linux_3 39.44% <42.85%> (+<0.01%) ⬆️
Linux_4 33.74% <0.00%> (-0.01%) ⬇️
Windows_1 26.57% <0.00%> (-0.01%) ⬇️
Windows_2 38.90% <ø> (ø)
Windows_3 39.45% <42.85%> (+<0.01%) ⬆️
Windows_4 33.74% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

const currentHash = window.location.hash.split('?')[0];
const isSavedSearchUrl = currentHash.includes('#/view/');
const hasUrlParams = window.location.hash.includes('?');
const shouldSkipFilters = isSavedSearchUrl && !hasUrlParams;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't get why it should check hasUrlParams here, could you elaborate please?

syncKeys.push('appFilters');
}

const initialStateFromURL: QueryState = osdUrlStateStorage.get('_q') ?? {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe unrelated to this PR: the name initialStateFromURL is a bit misleading, because it's not just url state, it also reads in-memory state

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe unrelated to this PR, it seems in connectStorageToQueryState, we're doing two-way state syncing memory state <-> url sate, do you know the intention?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

distinguished-contributor OSD Changes being merged by the OSD team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]Dashboard filters persist across index patterns when switching from Saved Objects to Discover view (OpenSearch 2.19 / 3.1)

2 participants